﻿using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Trippy.CollidableGameComponents;
using Trippy.CollidableGameComponents.Agents;
using Trippy.Levels;
using Trippy.Animation;

namespace Trippy.Abilities
{
    class Shrink : Ability
    {
        public Shrink(Level level) : base (level)
        {
            State = AbilityState.Available;
            name = "Shrink";
            icon = CurrentLevel.Game.Content.Load<Texture2D>("Sprites/Ability Icons/shrink");
        }

        public override void OnAdd()
        {
            State = AbilityState.Available;
        }

        public override void OnActivate()
        {
            State = AbilityState.Active;
            EffectAnimation e = new EffectAnimation(CurrentLevel, EffectAnimation.Effects.SmokeBomb, CurrentLevel.Hero.Position);
            e.AttachToComponent(CurrentLevel.Hero);
            CurrentLevel.Hero.Scale = new Vector2(0.5f, 0.5f);
 	        base.OnActivate();
        }

        public override void OnCancel()
        {
            State = AbilityState.Available;
            EffectAnimation e = new EffectAnimation(CurrentLevel, EffectAnimation.Effects.SmokeBomb, CurrentLevel.Hero.Position);
            e.AttachToComponent(CurrentLevel.Hero);
            CurrentLevel.Hero.Scale = new Vector2(1.0f, 1.0f);
            base.OnCancel();
        }


        public override void OnRemove()
        {
            if (State == AbilityState.Active)
                OnCancel();
            base.OnRemove();
        }
    }
}
